<?php

namespace App\Http\Controllers\Admin;

use App\Models\Node;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class IndexController extends Controller
{
    //后台首页显示
    public  function  index(){

        return view('admin.index.index');
    }
    //欢迎页面
    public  function  welcome(){
        return view('admin.index.welcome');
    }
    //菜单
    public function getsysteminit(){

        $homeInfo = [
            'title' => '首页',
            'href'  => route("admin.welcome"),
        ];
        $logoInfo = [
            'title' => '后台管理系统',
            'image' => 'images/logo.png',
        ];

        $menuInfo = $this->getMenuList();

        $systemInit = [
            'homeInfo' => $homeInfo,
            'logoInfo' => $logoInfo,
            'menuInfo' => $menuInfo,
        ];
        return response()->json($systemInit);
    }

    // 获取菜单列表
    private function getMenuList(){
        return[
            [
            'title' => '后台管理',
            'href' => '',
            'icon' => 'fa fa-address-book',
            'target' => '_self', //获取当前登录用户权限
            'child' =>(new Node())->getMenuData(session('admin.auth'))
            ]
        ];
    }

}
